userDm is an array of objects, I am getting 0 every time, and the count of the console is increasing, instead I want to increment my present variable when the condition is true.
const userkey = "shubham.kesarwani@hp.com";
let [present, setPresent] = useState(0);
const userD = window.localStorage.getItem(userkey);
const userDm = JSON.parse(userD);
userDm.map((a) => {
if (a.atten === "Present") setPresent(present + 1);
});
console.log(p);